package cn.icanci.ladybird.service.impl;

import cn.icanci.ladybird.pojo.entity.TicketSeat;
import cn.icanci.ladybird.dao.TicketSeatDao;
import cn.icanci.ladybird.service.TicketSeatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TicketSeat)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 20:44:52
 */
@Service("ticketSeatService")
public class TicketSeatServiceImpl implements TicketSeatService {
    @Resource
    private TicketSeatDao ticketSeatDao;

    /**
     * 通过ID查询单条数据
     *
     * @param ticketSeatId 主键
     * @return 实例对象
     */
    @Override
    public TicketSeat queryById(Long ticketSeatId) {
        return this.ticketSeatDao.queryById(ticketSeatId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<TicketSeat> queryAllByLimit(int offset, int limit) {
        return this.ticketSeatDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param ticketSeat 实例对象
     * @return 实例对象
     */
    @Override
    public TicketSeat insert(TicketSeat ticketSeat) {
        this.ticketSeatDao.insert(ticketSeat);
        return ticketSeat;
    }

    /**
     * 修改数据
     *
     * @param ticketSeat 实例对象
     * @return 实例对象
     */
    @Override
    public TicketSeat update(TicketSeat ticketSeat) {
        this.ticketSeatDao.update(ticketSeat);
        return this.queryById(ticketSeat.getTicketSeatId());
    }

    /**
     * 通过主键删除数据
     *
     * @param ticketSeatId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long ticketSeatId) {
        return this.ticketSeatDao.deleteById(ticketSeatId) > 0;
    }

    /**
     * 通过主键查询多条语句
     * @param ticketSeatId 主键
     * @return 对象集合
     */
    @Override
    public List<TicketSeat> queryManyById(Long ticketSeatId) {
        return this.ticketSeatDao.queryManyById(ticketSeatId);

    }

    @Override
    public List<TicketSeat> queryManyByTicketDetailsId(Long ticketDetailsId) {
        return this.ticketSeatDao.queryManyByTicketDetailsId(ticketDetailsId);
    }

    @Override
    public TicketSeat updateByTicketSeatId(Long ticketSeatId) {
        return this.ticketSeatDao.updateByTicketSeatId(ticketSeatId);
    }
}